package com.lyw.springCloud.controller;

import com.lyw.springCloud.domain.CommonResult;
import com.lyw.springCloud.domain.Order;
import com.lyw.springCloud.service.StorageService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Auther liyawei
 * @Date 2022/5/22 10:04
 */

@Slf4j
@RestController
public class StorageController {

    @Resource
    private StorageService storageService;

    /**
     * 库存扣减
     */
    @PostMapping("/storage/decrease")
    public CommonResult decrease(@RequestBody Order order){

        storageService.decrease(order);

        return new CommonResult(200, "扣减库存成功！");
    }
}
